package jgl.vajra.operator.part.mine.activity;

import com.google.android.flexbox.FlexDirection;
import com.google.android.flexbox.FlexWrap;
import com.google.android.flexbox.FlexboxLayoutManager;

import java.util.ArrayList;
import java.util.List;

import jgl.vajra.operator.R;
import jgl.vajra.operator.databinding.ActivityPersonalSignatureBinding;
import jgl.vajra.operator.part.mine.contract.PersonalSignatureContract;
import jgl.vajra.operator.part.mine.viewModel.PersonalSignatureViewModel;
import jgl.vajra.operator.widget.databindingadapter.SingleTypeBindingAdapter;
import jgl.vajra.operator.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.operator.widget.mvvm.view.BaseMVVMActivity;
import jgl.vajra.operator.widget.utils.ToastUtils;

@CreateViewModel(PersonalSignatureViewModel.class)
public class PersonalSignatureActivity extends BaseMVVMActivity<PersonalSignatureViewModel, ActivityPersonalSignatureBinding>implements PersonalSignatureContract.View {
    @Override
    public int getLayoutId() {
        return R.layout.activity_personal_signature;
    }

    @Override
    public void initView() {
        super.initView();
        mBinding.setView(this);

        List<String> list=new ArrayList<>();
        list.add("为人民服务");
        list.add("越牛逼的人越谦虚，越没本事的人越装逼。");
        list.add("总有一天我会发光亮瞎你的眼。");
        list.add("沉睡的狮子醒来后，依然是王。");
        list.add("天欲逼我上绝路, 我定翻身捅破天。");
        list.add("对人恭敬，就是在庄严你自己。");
        list.add("被你们迷恋久了，哥也有点自恋了!");
        list.add("你光顾着算账了，忘了光顾我了。");

        // 不可嵌套滑动
        mBinding.recyclerView.setNestedScrollingEnabled(false);
        // 取消head 的 recycleView的焦点
        mBinding.recyclerView.setFocusableInTouchMode(false);

        FlexboxLayoutManager flManager = new FlexboxLayoutManager(this);
        flManager.setFlexWrap(FlexWrap.WRAP);
        //设置主轴的方向
        flManager.setFlexDirection(FlexDirection.ROW);
        //设置布局管理器
        mBinding.recyclerView.setLayoutManager(flManager);

        SingleTypeBindingAdapter adapter = new SingleTypeBindingAdapter(this, list, R.layout.item_city_choice);
        mBinding.recyclerView.setAdapter(adapter);
    }

    //保存
    @Override
    public void onDetermine() {
        ToastUtils.showShort("保存");
    }
}
